package com.qyp.content.test;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.qyp.content.sentinel.SentinelResourceBlockHandler;
import com.qyp.content.sentinel.SentinelResourceFallbackHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class SentinelResourceController {

    @GetMapping("/test-blockHandler")
    @SentinelResource(value = "blockHandler",
            blockHandler = "block",
            blockHandlerClass = SentinelResourceBlockHandler.class,
            fallback = "fallBack",
            fallbackClass = SentinelResourceFallbackHandler.class,
            defaultFallback = "block"
    )
    public String testBlockHandler(String a, String b) throws InterruptedException {
        throw new IllegalArgumentException();
    }

}
